# -*- mode: python -*-

# This SConscript used to describe the build and install rules for the Mongo C++ driver. Now it
# causes the relevant targets to emit an error message informing users that the client driver
# is now maintained in a separate repo, and provides a link to the documentation on how to
# build the driver.

import os
import textwrap

Import('env')

def failClient(target, source, env):
    failClientMessage = '''
    PLEASE NOTE: The C++ client driver repository has been moved to
    http://github.com/mongodb/mongo-cxx-driver

    As of MongoDB 2.6.0, the C++ client library has been separated from the core database
    server repository into a separate git repository. The targets specific to the C++ driver
    can no longer be built from the server codebase.

    In particular, the following targets are no longer availble in this repository:
     mongoclient
     install-mongoclient
     check-install-mongoclient
     clientTests
     smokeClient

    Additionally, the following SCons options no longer have any effect in this repository,
    though they are accepted without error for backward compatibility:
     --sharedclient
     --full
     --disable-declspec-thread

    For detailed instructions on how to build the C++ driver, please
    see http://dochub.mongodb.org/core/build-cpp-driver
    '''
    print(textwrap.dedent(failClientMessage))
    Exit(1)

failClientAction = env.Action(failClient, cmdstr=None)
failClientTargets = [
    'check-install-mongoclient',
    'clientTests',
    'install-mongoclient',
    'mongoclient',
    'smokeClient',
]

env.AlwaysBuild(
    [env.Alias(target, [], failClientAction) for target in failClientTargets]
)
